Insert Column in a module

I have the following code and I need to insert a colum for every user defined attribute
Can anyone help me with this.

AttrDef ad
Module m = current
string attrName
int count = 0

for ad in m do
{
if ((ad.object) && (!ad.system))
{
attrName = ad.name
if((attrName == "RTF NonShpPict") || (attrName == "RTF ShpPict"))
{
attrName = null
}
else
{
count ++
insert (attrName count)
}

}
}
SystemAdmin - Fri May 15 08:30:00 EDT 2009

Re: Insert Column in a module
llandale - Fri May 15 09:29:06 EDT 2009

When posting, surround your code with two of these: { c o d e }, without the spaces.

AttrDef ad
Module m = current
string attrName
int count = 0
Column col
for col in m do
{  count++}
print "Col Count = " count"\n"
for ad in m do
{
   if ((ad.object) && (!ad.system)) 
   {
      attrName = ad.name
      if((attrName == "RTF NonShpPict") || (attrName == "RTF ShpPict"))
      {
         attrName = null
      }
      else 
      {  print "Inserting column " count "\n"
         col = insert (column count)
         attribute(col, attrName)
         width(col, 200)
         count ++
      }
   }
}

Re: Insert Column in a module
Bob_Swan - Wed May 20 03:03:15 EDT 2009

Don't forget that there is a limit to the number of columns, (32 where 1st =0), so you either need to handle the error that DOORS will throw at that point, or limit the numbers you create.